/*
 * Demo pathes
 */

var appendParagraph = function(text) {
	$('#demo-text-container').append('<p>' + text + '</p>');
}

var appendBlockquote = function(text) {
	$('#demo-text-container').append('<blockquote><p>' + text + '</p></blockquote>');
}

$.aws.pathes = {
	'i': {
		name: 'Info',
		description: 'Displays some basic info about this page',
		onEnter: {
			description: 'Show information',
			exec: function() {
				alert('This page URL is "' + location.href + '". Title of this page is "' + document.title + '"');
			},
			isAvailable: function() {
				return true;
			}
		}
	},
	'd': {
		name: 'Document',
		description: 'Container. Groups other waypoints.',
		next: {
			'a': {
				name: 'Append',
				description: 'Container. Groups other waypoints.',
				next: {
					'p': {
						name: 'Paragraph',
						description: 'Appends paragraph with text you can input now',
						next: {
							value: '',
							description: 'Append paragraph with given text to document',
							onEnter: {
								description: 'Append',
								exec: function() {
									appendParagraph($.aws.waypoint.value);
									$.aws.reset();
								},
								isAvailable: function() {
									return 1 + 4 == 6 - 1;
								}
							}
						}
					},
					'b': {
						name: 'Blockquote',
						description: 'Appends blockquote with text you can input now',
						next: {
							value: '',
							description: 'Append blockquote with given text to document',
							onEnter: {
								description: 'Append',
								exec: function() {
									appendBlockquote($.aws.waypoint.value);
									$.aws.reset();
								},
								isAvailable: function() {
									return 1 + 4 == 6 - 1;
								}
							}
						}
					}
				}
			}
		}
	}
}
